package com.ky.exception;


import com.ky.Common.Result;
//import com.shixun.Common.Result;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//标注是异常处理器
@RestControllerAdvice
public class globalExceptionHander {
    @ExceptionHandler(Exception.class)
    public Result hander(Exception e){
        e.printStackTrace ();
      //返回相应的json的字符串
        return Result.fail (StringUtils.hasLength (e.getMessage ())?e.getMessage () : "操作失败");
    }
}
